package com.ruoyi.fastDfs.impl;


import com.ruoyi.common.utils.FastdfsUtil;
import com.ruoyi.fastDfs.IFastDfsService;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

@Service
public class FastDfsServiceImpl implements IFastDfsService {

    //@Value("${fastDfs.prefix}")
    private String prefixUrl;

    @Override
    public String upload(byte[] files, String extension) {
        return this.prefixUrl+ FastdfsUtil.upload(files, extension);
    }

    @Override
    public void delete(String path) {
        String substring = path.substring(this.prefixUrl.length());
        FastdfsUtil.delete(substring);

    }
}